package Array01;


import Array.Mycomparator;
import com.sun.org.apache.xml.internal.security.Init;
import com.sun.xml.internal.ws.policy.PolicyMapKey;

import java.util.*;

public class DouDiZhuGame {

    /**
     * 将54张扑克牌初始化并放在对应的集合里面
     */

    List<String> pokeList=new ArrayList<>();
    public void init() {
        //定义花色和大小
        String []type={"黑桃","红桃","方块","梅花"};
        String []number={"3","4","5","6","7","8","9","10","J","Q","K","A","2"};

        //将花色和大小匹配，形成一副扑克序列
        for(int i=0;i<4;i++){
            for(int j=0;j<13;j++){
                pokeList.add(type[i]+number[j]);
            }
        }
        pokeList.add("大王");
        pokeList.add("小王");
    }


    /**
     * 洗牌
     */
    public  void xipai(){
     Collections.shuffle(pokeList);
//        System.out.println(pokeList.toString());
    }

    /**
     * 发牌
     */
    public void send() {
        Puke puke=new Puke();
        ArrayList<String> A = new ArrayList(pokeList.subList(0,16));
        ArrayList<String> B = new ArrayList(pokeList.subList(17,34));
        ArrayList<String> C = new ArrayList(pokeList.subList(35,51));
        ArrayList<String> D = new ArrayList(pokeList.subList(51,54));
//        Collections.sort(A,new Mycomparator());
//        Collections.sort(B,new Mycomparator());
//        Collections.sort(C,new Mycomparator());
//
        System.out.println("小明  "+A );
        System.out.println("小王  "+B);
        System.out.println("小强  "+C);
        System.out.println("地主牌  "+D);

    }
    public static void main(String[] args) {
        DouDiZhuGame douDiZhuGame=new DouDiZhuGame();
        douDiZhuGame.init();
        douDiZhuGame.xipai();
          douDiZhuGame.send();



    }
}
